package com.wawei.seeds.adapter;

import android.content.Context;
import android.widget.BaseAdapter;

import com.wawei.seeds.utils.ImageLoader;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * Created by t27891 on 15/6/22.
 */
public abstract class SeedsBaseAdapter<T> extends BaseAdapter{
    Context context;
    ImageLoader imageLoader;
    private List<T> dataset = new ArrayList<>(0);

    public SeedsBaseAdapter(Context context){
        this.context = context;
        this.imageLoader = new ImageLoader(context);
    }

    public void setDataset(List<T> dataset) {
        this.dataset = dataset;
    }

    public void appendDataset(List<T> dataset){
        this.dataset.addAll(dataset);
    }

    public void insertDataset(List<T> dataset){
        this.dataset.addAll(0, dataset);
    }

    public void clear(){
        dataset.clear();
    }

    @Override
    public int getCount() {
        return dataset.size();
    }

    @Override
    public Object getItem(int position) {
        return dataset.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

}
